package com.wing.cabinet.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wing.cabinet.model.entity.CabinetCargoSpace;
import com.wing.cabinet.model.entity.StorageInventoryInout;
import com.wing.cabinet.model.entity.StorageInventoryInoutDetail;
import com.wing.cabinet.model.entity.UseInventoryInout;
import com.wing.cabinet.model.request.StorageInventoryInoutDetailForm;
import com.wing.cabinet.model.request.StorageInventoryInoutForm;
import com.wing.cabinet.model.request.UseInventoryInoutDetailForm;
import com.wing.cabinet.model.request.UseInventoryInoutForm;
import com.wing.cabinet.model.response.CabSpaceResultVO;
import com.wing.cabinet.model.response.CabinetCargoSpaceVO;
import com.wing.cabinet.model.response.ScrapApplyVO;
import com.wing.cabinet.model.response.StorageInventoryInoutDetailVO;
import com.wing.common.utils.JsonResult;
import com.wing.order.model.request.OrderReceiveLoadForm;
import org.apache.ibatis.annotations.Param;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 暂存柜存刀/取刀;存/取维修/回收刀明细-Service
 *
 * @author
 */
public interface StorageInventoryInoutDetailService extends IService<StorageInventoryInoutDetail> {

    /**
     * 添加
     *
     * @param storageInventoryInoutDetailForm
     * @return
     */
    int add(StorageInventoryInoutDetailForm storageInventoryInoutDetailForm);

    /**
     * 列表-app
     *
     * @param params
     *
     * @return
     */
    List<StorageInventoryInoutDetailVO> list4app(Map<String, Object> params);

    /**
     * 分页list-app
     *
     * @param page
     * @param params
     *
     * @return
     */
    Page<StorageInventoryInoutDetailVO> pageList4app(Page page, Map<String, Object> params);

    /**
     * 详情-app
     *
     * @param id
     *
     * @return
     */
    StorageInventoryInoutDetailVO get4appById(Long id);

    int update4Check(Integer businessTypeChecked, Long inoutId);

    StorageInventoryInout inventoryIn(List<UseInventoryInoutDetailForm> list, StorageInventoryInout.BusinessType businessType,String deviceCode,StorageInventoryInout.BusinessDetailType businessDetailType,String remark);

    void inventoryIn4Check(List<StorageInventoryInoutDetailForm> list,Long checkedResultId, StorageInventoryInout.BusinessType businessType,StorageInventoryInout.BusinessDetailType businessDetailType,StorageInventoryInout.BusinessTypePre businessTypePre,Long storageInventoryOutId,Long storageInventoryCheckId);

    StorageInventoryInout inventoryOut(List<UseInventoryInoutDetailForm> list,StorageInventoryInout.BusinessType businessType,String deviceCode,StorageInventoryInout.BusinessDetailType businessDetailType,UseInventoryInout.BusinessType useBusinessType);

    void inventoryOutEmpty(List<UseInventoryInoutDetailForm> list,StorageInventoryInout.BusinessType businessType,String deviceCode,StorageInventoryInout.BusinessDetailType businessDetailType,UseInventoryInout.BusinessType useBusinessType);

    StorageInventoryInout inventoryOut4Check(List<StorageInventoryInoutDetailForm> list,StorageInventoryInout.BusinessType businessType,Long checkedResultId,StorageInventoryInout.BusinessDetailType businessDetailType,StorageInventoryInout.BusinessTypeChecked businessTypeChecked,Long checkedInventoryInoutId);

    CabinetCargoSpaceVO getUsableSpaces(UseInventoryInoutDetailForm useInventoryInoutDetailForm, StorageInventoryInout.BusinessType businessType);

    CabinetCargoSpaceVO getUsableSpaces(CabinetCargoSpace.SpaceNature spaceNature,String cabCodes,String skuCode, StorageInventoryInout.BusinessType businessType);

    CabinetCargoSpaceVO getSpaces(CabinetCargoSpace.SpaceNature spaceNature, String cabCodes, String skuCode, StorageInventoryInout.BusinessType businessType);

    CabinetCargoSpaceVO getSpaces(CabinetCargoSpace.SpaceNature spaceNature, String cabCodes, List<String> skuCodes, StorageInventoryInout.BusinessType businessType,Integer quantity);

    CabSpaceResultVO getUserSpaces(CabinetCargoSpace.SpaceNature spaceNature, String cabCodes, String skuCode, StorageInventoryInout.BusinessType businessType, List<Integer> spaceTypes);

    CabSpaceResultVO getUserSpaces(CabinetCargoSpace.SpaceNature spaceNature, String cabCodes, List<String> skuCode, StorageInventoryInout.BusinessType businessType,List<Integer> spaceTypes,Integer quantity);

    CabinetCargoSpaceVO getSpaces4OldNew(CabinetCargoSpace.SpaceNature spaceNature, String cabCodes, String skuCode, StorageInventoryInout.BusinessType businessType,Integer quantity);

    CabinetCargoSpaceVO getSpaces4OldNewMoreKnife(CabinetCargoSpace.SpaceNature spaceNature, String cabCodes, List<String> skuCode, StorageInventoryInout.BusinessType businessType,Integer quantity);

    CabinetCargoSpaceVO getSpaces4OldNew(CabinetCargoSpace.SpaceNature spaceNature, String cabCodes, List<String> skuCodes, StorageInventoryInout.BusinessType businessType,Integer quantity);

    CabinetCargoSpaceVO getUsedSpaces(UseInventoryInoutDetailForm useInventoryInoutDetailForm, StorageInventoryInout.BusinessType businessType);

    JsonResult<List<CabinetCargoSpaceVO>> getCheckedSpace(UseInventoryInoutDetailForm useInventoryInoutDetailForm, StorageInventoryInout.BusinessType businessType);



    /**
     * 我的待办任务列表 -app
     */
    Page<StorageInventoryInoutDetailVO> toDoTask(Page page);

    /**
     * 我的待办任务产品查询 -app
     */
    List<ScrapApplyVO> selTaskPro(String id);



    /**
     * 盘验任务列表  所有柜子信息 -app
     */
    Page<ScrapApplyVO>diskTask(Page page);


    /**
     * 盘验 根据柜子编号查询当前柜子的信息
     * @param cabCode
     * @return
     */
    ScrapApplyVO getCabinet(String cabCode);


    /**
     * 盘验 柜子下库位的信息 -app
     */
    Page<ScrapApplyVO> diskStorage(Map<String, Object> params,Page page);


    /**
     * 盘验结果 异常
     * @param page
     * @return
     */
    Page<ScrapApplyVO> diskResult(Page<ScrapApplyVO>page,Map<String,Object>params);


    /**
     * 盘验结果 正常
     * @param page
     * @return
     */
    Page<ScrapApplyVO> diskResultNormal(@Param("page")Page<ScrapApplyVO>page, @Param("params")Map<String,Object>params);


    /**
     * 维修订单
     */
    List<ScrapApplyVO>repairOrder();

    boolean check(Long spaceId, StorageInventoryInout.BusinessType businessType,boolean skuFlag);


    boolean check(StorageInventoryInoutDetailForm storageInventoryInoutDetailForm);

    boolean check(StorageInventoryInoutForm storageInventoryInoutForm);

    boolean check4Wx(StorageInventoryInoutForm storageInventoryInoutForm) throws IOException;

    boolean checkOrder(Long orderId, StorageInventoryInout.BusinessType businessType);

    boolean sign(Long orderId, BigDecimal repairPrice, Integer quantitySign);

    boolean notify(Long checkResultId,Long supplierId,String supplierName);

    void latticeCabinetUp(OrderReceiveLoadForm orderReceiveLoadForm);

    StorageInventoryInout latticeCabinetUnload(OrderReceiveLoadForm orderReceiveLoadForm);

    /**
     * 小柜子存维修刀
     * @param useInventoryInoutForm
     * @param businessType
     * @param businessDetailType
     * @return
     */
    StorageInventoryInout xgzInventoryRepairIn(UseInventoryInoutForm useInventoryInoutForm, StorageInventoryInout.BusinessType businessType, StorageInventoryInout.BusinessDetailType businessDetailType);

    /**
     * 小柜子存回收刀
     * @param useInventoryInoutForm
     * @param businessType
     * @param businessDetailType
     * @return
     */
    StorageInventoryInout xgzInventoryRecycleIn(UseInventoryInoutForm useInventoryInoutForm, StorageInventoryInout.BusinessType businessType, StorageInventoryInout.BusinessDetailType businessDetailType);

}
